If Notes(1).Chord <> "" Then CurrentChord = Notes(1).Chord Else CurrentChord = ""
tmrPlay.Interval = 1
'tmrMetro.Interval = 1
'tmrMetro.Enabled = True
tmrPlay.Enabled = True
tmrScroll.Enabled = True
End Sub
Private Sub UserControl_EnterFocus()
Call CreateCaret(UserControl.hwnd, 0, 2, 40)
Call ShowCaret(UserControl.hwnd)
End Sub
Private Sub UserControl_Initialize()
Chords(0) = ":1;5;8"
Chords(1) = "6:1;5;8;10"
Chords(2) = "7:1;5;8;11"
Chords(3) = "maj7:1;5;8;12"
Chords(4) = "9:1;5;8;11;15"
Chords(5) = "m:1;4;8"
Chords(6) = "m6:1;4;8;10"
Chords(7) = "m7:1;4;8;11"
Chords(8) = "m maj7:1;4;8;12"
Chords(9) = "m9:1;4;8;11;15"
Chords(10) = "dim:1;4;7"
Chords(11) = "aug:1;5;9"
Chords(12) = "sus4:1;6;8"
Chords(13) = "add9:1;5;8;15"
Chords(14) = "11:1;5;8;11;15;18"
Chords(15) = "13:1;5;8;11;15;18;22"
Chords(16) = "6add9:1;5;8;10;15"
Chords(17) = "-5:1;5;7"
Chords(18) = "7-5:1;5;7;11"
Chords(19) = "7 maj5:1;5;9;11"
Chords(20) = "7 sus4:1;6;8;11"
Chords(21) = "maj9:1;5;8;12;15"
Tones(0) = "C"
Tones(1) = "C#/Db"
Tones(2) = "D"
Tones(3) = "D#/Eb"
Tones(4) = "E"
Tones(5) = "F"
Tones(6) = "F#/Gb"
Tones(7) = "G"
Tones(8) = "G#/Ab"
Tones(9) = "A"
Tones(10) = "A#/Bb"
Tones(11) = "B"
Tones(12) = "C"
Tones(13) = "C#/Db"
Tones(14) = "D"
Tones(15) = "D#/Eb"
Tones(16) = "E"
Tones(17) = "F"
Tones(18) = "F#/Gb"
Tones(19) = "G"
Tones(20) = "G#/Ab"
Tones(21) = "A"
Tones(22) = "A#/Bb"
Tones(23) = "B"
Tones(24) = "C"
Tones(25) = "C#/Db"
Tones(26) = "D"
Tones(27) = "D#/Eb"
Tones(28) = "E"
Tones(29) = "F"
Tones(30) = "F#/Gb"
Tones(31) = "G"
Tones(32) = "G#/Ab"
Tones(33) = "A"
Tones(34) = "A#/Bb"
Tones(35) = "B"
Tones(36) = "C"
Space = 45
TimeSignature = 1
Signature = 0
Call DrawLines
End Sub
Sub SetChord(Chord As String)
Dim i As Integer
Dim x As Integer
Dim Chord1() As String
Dim Chord2() As String
Dim Base As Integer
Dim NewChord As String
Dim NewChord2 As String
Dim Upper As Integer
Dim Pitch As Integer
Dim B() As String
Dim T() As String
Dim Tone As String
On Error Resume Next
If Chord = "" Then Exit Sub
Pitch = 12
If Mid$(Chord, 2, 1) = "#" Or Mid$(Chord, 2, 1) = "b" Then
NewChord = Left$(Chord, 2)
NewChord2 = Right(Chord, Len(Chord) - 2)
Else
NewChord = Left$(Chord, 1)
NewChord2 = Right(Chord, Len(Chord) - 1)
End If
For i = 0 To 21
T = Split(Tones(i), "/")
If UBound(T) > 0 Then
If T(0) = NewChord Then
Base = i
Exit For
ElseIf T(1) = NewChord Then
Base = i
Exit For
End If
Else
If Tones(i) = NewChord Then
Base = i
Exit For
End If
End If
Next i
For i = 0 To 21
B = Split(Chords(i), ":")
If B(0) = NewChord2 Then
Upper = i
Exit For
End If
Next i
Chord1 = Split(Chords(Upper), ":")
If UBound(Chord1) > 0 Then Chord2 = Split(Chord1(1), ";")
For i = 0 To 36 + 12 + Pitch
Call StopNote(i)
Next i
For i = 0 To 36
For x = 0 To UBound(Chord2)
If i + 1 = Chord2(x) + Base Then
Call StartNote(i + 12 + Pitch, 80)
End If
Next x
Next i
End Sub
Public Sub ChangeTime(Value As Single)
TimeSignature = Value
Call DrawLines(Scroll)
End Sub
Public Sub ChangeSignature(Value As Single)
Signature = Value
Call DrawLines(Scroll)
End Sub
Private Sub DrawLines(Optional Val As Long, Optional Start As Long = 1)
Dim i As Long
Dim u As Long
Dim e As Long
Dim Values As Single
Dim Value As Long
Dim NotePos As Integer
On Error Resume Next
'Bildschirm l÷schen und Notenschlⁿssel zeichnen
Call UserControl.Cls
UserControl.DrawWidth = 1
UserControl.CurrentX = 5 - Val
UserControl.CurrentY = 35
UserControl.Print Chr$(65)
'Vorzeichen
Select Case Signature
Case 0
Additional = 0
Case 1
UserControl.CurrentY = 14
UserControl.CurrentX = 30 - Val
UserControl.Print Chr(83)
Additional = 9
Case 2
UserControl.CurrentY = 14
UserControl.CurrentX = 30 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 24
UserControl.CurrentX = 38 - Val
UserControl.Print Chr(83)
Additional = 18
Case 3
UserControl.CurrentY = 14
UserControl.CurrentX = 30 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 24
UserControl.CurrentX = 38 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 9
UserControl.CurrentX = 46 - Val
UserControl.Print Chr(83)
Additional = 27
Case 4
UserControl.CurrentY = 14
UserControl.CurrentX = 30 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 24
UserControl.CurrentX = 38 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 9
UserControl.CurrentX = 46 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 21
UserControl.CurrentX = 54 - Val
UserControl.Print Chr(83)
Additional = 36
Case 5
UserControl.CurrentY = 14
UserControl.CurrentX = 30 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 24
UserControl.CurrentX = 38 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 9
UserControl.CurrentX = 46 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 21
UserControl.CurrentX = 54 - Val
UserControl.Print Chr(83)
UserControl.CurrentY = 31
UserControl.CurrentX = 62 - Val
UserControl.Print Chr(83)
Additional = 45
End Select
UserControl.CurrentY = 21
UserControl.CurrentX = 30 - Val + Additional
'Takt zeichnen (ZΣhler)
If TimeSignature = 1 Then
UserControl.Print Chr(52)
ElseIf TimeSignature = 0.75 Then
UserControl.Print Chr(51)
ElseIf TimeSignature = 0.5 Then
UserControl.Print Chr(50)
End If
'Takt zeichnen (Nenner)
UserControl.CurrentY = 35
UserControl.CurrentX = 30 - Val + Additional
UserControl.Print Chr(52)
'Notenlinien zeichnen
UserControl.Line (0, 50)-(UserControl.Width, 50)
UserControl.Line (0, 57)-(UserControl.Width, 57)
UserControl.Line (0, 64)-(UserControl.Width, 64)
UserControl.Line (0, 71)-(UserControl.Width, 71)
UserControl.Line (0, 78)-(UserControl.Width, 78)
MaxLength = 0
'Alle Noten zeichnen
For i = Start To Notes.Count
NotePos = Notes(i).NotePos
UserControl.DrawWidth = 1
'Maximale BalkenlΣnge errechnen
For u = i To Notes.Count
If Notes(u).Join = True Then
If Notes(u).Note > MaxLength Then
MaxLength = Notes(u).Note
Else
MaxLength = MaxLength
End If
Else
Exit For
End If
Next u
'Nur Noten zeichnen, die auf den Bildschirm passen
If (i * Space + 25 + Additionalntr2e2 If Key = 9 Then Add = y 9 T= y 9 T= y 9 T= y 9 T= y 9 T= y 9 TT= y 9 T= y 9 Tdy 9Theni TT= y 9 T= y 9 Tdy 9Theni TT= y 9 T= y 9 Tdy 9The(uf den Bildschirm passen 9 T= y 9 Tdy 9T-dddddddddd8= y 9 T= y 9 TdddsT-dddddddr
End2'lliY7(1 End2'lliY7(1 End2'lld2'lliY7(1 En End23 UserC,1rint Chr(83)
UserControl.CurrentY = 9
UserControl.CurrentX = 46 - Val
UserCon1)-(UserControl.Width, 64)
UserControl.LinetX = 38 - Val
UserControl.Print Chr(83)
4ntY = 9
UserConY =heniCurrentY = dd n1 od If
Eu=u9rentY = dd If
Eu=u9rentY = dd If
Eu=u9rentY = UserControl.CurrentX = 30 - Val
f, 64)
Un Eldy 9Theni TT= y 9o 4ntY = 9
= 30 - Val71trol.Line (0, 78) 9o 4ntY = 9
= 30 - Valh = MaxLengthalh = MaxLengthY = y 9o 4ntY= y 9 TdddsT-dddddddr